package com.day4.serializedev;

import com.day4.serializedev.impl.JSONSerializer;

/**
 * @author leonard
 * @Description 序列化接口
 * @date 2021-05-24 12:32
 */
public interface Serializer {

    //设置默认序列化为json
    Serializer DEFAULT = new JSONSerializer();

    byte JSON_TYPE = 1;

    //序列化算法
    byte getSerializerAlgorithm();

    //java对象-->二进制
    byte[] serialze(Object object);

    //二进制-->java对象
    <T> T deserialze(Class<T> clazz,byte[] bytes);
}
